@extends('layouts.admin.layout')

@section('css')
    <link rel="stylesheet" href="/backend/daterangepicker/daterangepicker.css">
@endsection

@section('content')
    <div class="admin-content-body">
        <div class="am-cf am-padding am-padding-bottom-0">
            <div class="am-fl am-cf"><strong class="am-text-primary am-text-lg">快速申请列表</strong> /
                <small>Fast Apply</small>
            </div>
        </div>

        <hr>
        @include('layouts.admin._flash')

        <div class="am-g">
            <div class="am-cf am-padding">
                <form class="am-form-inline" role="form" method="post" action="{{url('admin/fastApply/index')}}">
                    {!! csrf_field() !!}
                    <div class="am-form-group">
                        <input type="text" class="am-form-field am-input-sm" name="name"
                               value="{{Request::input('name')}}" placeholder="姓名">
                    </div>
                    <div class="am-form-group">
                        <input type="text" class="am-form-field am-input-sm" name="mobile"
                               value="{{Request::input('mobile')}}" placeholder="手机">
                    </div>
                    <div class="am-form-group">
                        <select data-am-selected="{btnSize: 'sm'}" name="status">
                            <option value="-100" @if(Request::input('status') == '-100') selected @endif>请选择状态</option>
                            @foreach($status1 as $key=>$value)
                                <option value="{{$key}}"
                                        @if(Request::input('status') && (Request::input('status') == $key)) selected @endif>{{$value}}</option>
                            @endforeach
                        </select>
                    </div>

                    {{--<div class="am-form-group">
                        <div class="am-btn-group">
                            <label class="am-btn am-btn-default am-btn-xs am-radius">
                                <input type="checkbox" name="is_top" value="1"
                                       @if(Request::input('is_top')==1) checked @endif> 置顶
                            </label>
                            <label class="am-btn am-btn-default am-btn-xs am-radius">
                                <input type="checkbox" name="is_recommend" value="1"
                                       @if(Request::input('is_recommend')==1) checked @endif> 推荐
                            </label>
                            <label class="am-btn am-btn-default am-btn-xs am-radius">
                                <input type="checkbox" name="is_hot" value="1"
                                       @if(Request::input('is_hot')==1) checked @endif> 热销
                            </label>
                            <label class="am-btn am-btn-default am-btn-xs am-radius">
                                <input type="checkbox" name="is_new" value="1"
                                       @if(Request::input('is_new')==1) checked @endif> 新品
                            </label>
                        </div>

                    </div>
                    <div class="am-form-group">
                        <select data-am-selected="{btnSize: 'sm'}">
                            <option value="-1" @if(Request::input('is_onsale')==-1) selected @endif>上架状态</option>
                            <option value="1" @if(Request::input('is_onsale')==1) selected @endif>上架</option>
                            <option value="0" @if(Request::input('is_onsale')==0) selected @endif>下架</option>
                        </select>
                    </div>--}}
                    <div class="am-form-group">
                        <input type="text" id="created_at" name="created_at" class="am-form-field am-input-sm"
                               placeholder="选择日期">
                    </div>
                    <div class="am-form-group">
                        <button class="am-btn am-btn-default am-btn-sm am-radius">查询</button>
                    </div>
                </form>
            </div>
        </div>

        <div class="am-g">
            <div class="am-cf am-padding">
                <form class="am-form-inline" role="form" method="post"
                      action="{{url('admin/fastApply/exportExcel')}}">
                    {!! csrf_field() !!}
                    <div class="am-form-group">
                        <input type="text" class="am-form-field am-input-sm" name="name"
                               value="{{Request::input('name')}}" placeholder="姓名">
                    </div>
                    <div class="am-form-group">
                        <input type="text" class="am-form-field am-input-sm" name="mobile"
                               value="{{Request::input('mobile')}}" placeholder="手机">
                    </div>
                    <div class="am-form-group">
                        <select data-am-selected="{btnSize: 'sm'}" name="status">
                            <option value="-100" @if(Request::input('status') == '-100') selected @endif>请选择状态</option>
                            @foreach($status1 as $key=>$value)
                                <option value="{{$key}}"
                                        @if(Request::input('status') && (Request::input('status') == $key)) selected @endif>{{$value}}</option>
                            @endforeach
                        </select>
                    </div>

                    <div class="am-form-group">
                        <input type="text" id="time" name="created_at" class="am-form-field am-input-sm"
                               placeholder="选择日期">
                    </div>
                    <div class="am-form-group">
                        <button class="am-btn am-btn-default am-btn-sm am-radius">导表</button>
                    </div>
                </form>
            </div>
        </div>

        <div class="am-g">
            <div class="am-u-sm-12">
                <form class="am-form">
                    <table class="am-table am-table-striped am-table-hover table-main">
                        <thead>
                        <tr>
                            <th class="table-id">ID</th>
                            <th class="table-title">姓名</th>
                            <th class="table-title">手机</th>
                            <th class="table-type">创建时间</th>
                            <th class="table-type">状态</th>
                            <th class="table-set">操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        @foreach($records as $record)
                            <tr>
                                <td>{{$record->id}}</td>
                                <td>{{$record->name}}</td>
                                <td>{{$record->mobile}}</td>
                                <td>{{$record->create_time}}</td>
                                <td class="am-hide-sm-only">{{$status[$record->status]}}{{$record->status}}</td>
                                <td>
                                    <div class="am-btn-toolbar">
                                        <div class="am-btn-group am-btn-group-xs">
                                            <a href="{{--{{route('auth.admin_edit', $admin->id)}}--}}"
                                               class="am-btn am-btn-default am-btn-xs am-text-secondary"><span
                                                        class="am-icon-pencil-square-o"></span> 编辑</a>
                                            <a href="{{route('fastApply.destroy', $record->id)}}" data-method="delete"
                                               data-token="{{csrf_token()}}" data-confirm="确定删除吗?"
                                               class="am-btn am-btn-default am-btn-xs am-text-danger am-hide-sm-only">
                                                <span class="am-icon-trash-o"></span> 删除
                                            </a>
                                        </div>
                                    </div>
                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                    <div class="am-cf">
                        共 {{$records->total()}} 条记录
                        <div class="am-fr">
                            {{-- <ul class="am-pagination">
                                 <li class="am-disabled"><a href="#">«</a></li>
                                 <li class="am-active"><a href="#">1</a></li>
                                 <li><a href="#">2</a></li>
                                 <li><a href="#">3</a></li>
                                 <li><a href="#">4</a></li>
                                 <li><a href="#">5</a></li>
                                 <li><a href="#">»</a></li>
                             </ul>--}}
                            {{--{{ $brands->links() }}--}}
                            {!! $records->appends(Request::all())->links() !!}
                        </div>
                    </div>
                    <hr/>
                    <p>注：.....</p>
                </form>
            </div>

        </div>
    </div>
@endsection

@section('js')
    <script src="/backend/daterangepicker/moment.js"></script>
    <script src="/backend/daterangepicker/daterangepicker.js"></script>
    <script src="/backend/daterangepicker/daterange_config.js"></script>
@endsection